﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Proggy.Data.Entities;
using Proggy.Data.Abstract;
using System.Web;

namespace Proggy.Web.Cms.ViewModels
{
    /// <summary>
    /// View model for /Proggy/Index
    /// </summary>
    public class ContentHomeViewModel
    {
        /// <summary>
        /// Constuctor
        /// </summary>
        public ContentHomeViewModel(INodeRepository repo)
        {
            //    
            this._repo = repo;

            // set root
            this.RootNode = repo.GetRootNode();

            // set check
            this.NoRootNode = this.RootNode == null;
        }

        // repo
        INodeRepository _repo;

        /// <summary>
        /// If true, no content created yet
        /// </summary>
        public bool NoRootNode { get; set; }

        /// <summary>
        /// The root node (or null)
        /// </summary>
        public PublishableNode RootNode { get; set; }
    }
}
